Repository navigation
fix: run ui-web page assembly on the project's pinned Python - #599
Merged
Merged
Conversation
build-ui assembled the served page with a bare `python3`, which resolves to whatever interpreter is first on PATH. On a stock macOS that is 3.9, where Path.write_text(newline=...) does not exist, so the documented `make build-ui` recipe died with a TypeError at ui-web/build.py line 198 after the vite build had already succeeded. pyproject requires-python is >=3.12 and every other Makefile target already runs its Python through uv; build-ui was the one caller that bypassed the pinned interpreter. Run the script through `uv run --frozen --python $(PYTHON_VERSION)`, matching install.sh, which already documents why the page assembly takes its Python from uv. Verified: reproduced the TypeError with Python 3.9.13 (exit 1); with uv + Python 3.12.7 the exact command builds dist/index.html, the artifact is byte-identical to the pre-change output on 3.12 (sha256 a1068871929266cfe746b5f321eb7faed2158785c8b19d4984783099b4c23181), check-page.mjs and the other page gates pass, and the artifact carries zero CR bytes. ui-web/build.py itself is untouched: its newline="" write needs 3.10+, but that half of the fix sits under the ui-web freeze and stays for maintainers.
Author
|
Hi — first contribution here: a one-line fix so the ui-web page assembly runs on the project's pinned Python instead of whatever is first on PATH. The |
gloryfromca
approved these changes
Sep 23, 2026
LivXue
pushed a commit
that referenced
this pull request
Oct 12, 2026
## What
`make build-ui` assembled the served page with a bare `python3`, which
resolves to whatever interpreter is first on PATH. On a stock macOS
(no Command Line Tools ahead of `/usr/bin/python3` = 3.9.6) the
documented self-hosting recipe `make install-deps && make build-ui`
died after the vite build had already succeeded:
File "ui-web/build.py", line 198, in main
(dist / "index.html").write_text(out, encoding="utf-8", newline="")
TypeError: write_text() got an unexpected keyword argument 'newline'
`Path.write_text(newline=...)` exists from Python 3.10, while pyproject
`requires-python` is `>=3.12` and every other Makefile target already
runs its Python through uv. `build-ui` was the one caller that bypassed
the pinned interpreter.
## Change
One line in the Makefile: run the script through
`uv run --frozen --python $(PYTHON_VERSION) python ui-web/build.py`,
the same form `install.sh` already uses for this script (and already
documents the rationale for). No source, test, or dependency changes.
`ui-web/build.py` itself is untouched: its `newline=""` write needs
3.10+, but that half of the fix sits under the ui-web freeze, so this PR
takes the Makefile half only, as the issue suggests.
CI keeps its bare `python3` (the ubuntu runners provide a working one
through setup-python / the runner image); this PR changes the documented
local path only.
## Verification
Reproduced the failure with Python 3.9.13 (the stock-macOS analogue):
$ python3.9 ui-web/build.py
TypeError: write_text() got an unexpected keyword argument 'newline'
(exit 1)
Then ran the changed target's commands in order, on Windows with
uv 0.12.17 and Python 3.12.7:
npm ci --prefix ui-web
npm run --prefix ui-web build
uv run --frozen --python 3.12 python ui-web/build.py -> exit 0
-> built dist/index.html (1,496,450 bytes)
Artifact checks:
sha256 ui-web/dist/index.html =
a1068871929266cfe746b5f321eb7faed2158785c8b19d4984783099b4c23181
(byte-identical to the pre-change output on 3.12)
node ui-web/scripts/check-page.mjs -> OK (3 scripts parse)
node ui-web/scripts/count-shared-globals.mjs -> OK
node ui-web/scripts/check-css.mjs -> OK
node ui-web/scripts/check-class-namespace.mjs -> OK
dist/index.html carries 0 CR bytes (LF-only artifact)
Repo gates on this commit:
scripts/check_source_language.py HEAD~1..HEAD -> pass
scripts/check_commit_messages.py HEAD~1..HEAD -> pass
Based on main at 87f3928.
Closes #526
AI disclosure: this PR was drafted with AI assistance (ZCode agent,
model step-5-preview); the reproduction, commands, and results above
were produced by it. The diff is one line; please review before merging.
Co-authored-by: insuffer <237025162+insuffer@users.noreply.github.com>
Co-authored-by: KT <74288668+0xKT@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
make build-uiassembled the served page with a barepython3, whichresolves to whatever interpreter is first on PATH. On a stock macOS
(no Command Line Tools ahead of
/usr/bin/python3= 3.9.6) thedocumented self-hosting recipe
make install-deps && make build-uidied after the vite build had already succeeded:
Path.write_text(newline=...)exists from Python 3.10, while pyprojectrequires-pythonis>=3.12and every other Makefile target alreadyruns its Python through uv.
build-uiwas the one caller that bypassedthe pinned interpreter.
Change
One line in the Makefile: run the script through
uv run --frozen --python $(PYTHON_VERSION) python ui-web/build.py,the same form
install.shalready uses for this script (and alreadydocuments the rationale for). No source, test, or dependency changes.
ui-web/build.pyitself is untouched: itsnewline=""write needs3.10+, but that half of the fix sits under the ui-web freeze, so this PR
takes the Makefile half only, as the issue suggests.
CI keeps its bare
python3(the ubuntu runners provide a working onethrough setup-python / the runner image); this PR changes the documented
local path only.
Verification
Reproduced the failure with Python 3.9.13 (the stock-macOS analogue):
Then ran the changed target's commands in order, on Windows with
uv 0.12.17 and Python 3.12.7:
Artifact checks:
Repo gates on this commit:
Based on main at 87f3928.
Closes #526
AI disclosure: this PR was drafted with AI assistance (ZCode agent,
model step-5-preview); the reproduction, commands, and results above
were produced by it. The diff is one line; please review before merging.